#include<stdio.h>
#include<string.h>

/*c语言指针学习第13课：初识结构体*/

struct Operators
{
    char name[100];
    int cost;
    char gender;
    double height;
};

int main()
{
    struct Operators Op1;
    strcpy(Op1.name, "夜刀");
    Op1.cost = 7;
    Op1.gender = 'F';
    Op1.height = 1.61;

    printf("干员%s，部署费用为 %dcost，性别 %c，身高 %.2lf米。\n",Op1.name,Op1.cost,Op1.gender,Op1.height);

    struct Operators Op2;
    strcpy(Op2.name, "黑角");
    Op2.cost = 14;
    Op2.gender = 'M';
    Op2.height = 1.8;

    printf("干员%s，部署费用为 %dcost，性别 %c，身高 %.2lf米。\n",Op2.name,Op2.cost,Op2.gender,Op2.height);

    //批量定义及结构体数组
    struct Operators Op3 = {"Rangers",7,'M',1.79};//巡林者
    struct Operators Op4 = {"Durin",12,'F',1.31};//杜林
    struct Operators Op5 = {"12F",24,'M',1.81};//12F

    struct Operators OpArr[5] = {Op1,Op2,Op3,Op4,Op5};

    for (int i = 2; i < 5; i++)
    {
        struct Operators temp = OpArr[i];
        printf("干员%s，部署费用为 %dcost，性别 %c，身高 %.2lf米。\n",temp.name,temp.cost,temp.gender,temp.height);
    }

    return 0;
}